import unittest
from ddt import ddt, data, unpack


# 案例1：单个数据
@ddt
class Test1(unittest.TestCase):
    @data('111', '122', '133', '144')
    def test1(self, value):
        print('打印values值：' + value)
        self.assertIn('1', value)


# 案例2：组合数据，未拆分
@ddt
class Test2(unittest.TestCase):
    @data(['aaa', 'abb', 'cbb'], ['add', 'aee', 'cff'])
    def test2(self, value):
        print(value)


# 案例3：组合数据，拆分（重点掌握
@ddt
class Test3(unittest.TestCase):
    @data(['aaa', 'abb', 'cbb'], ['add', 'aee', 'cff'])
    @unpack
    def test3(self, value1, value2, value3):
        print(value1, value2, value3)


# 执行一下
if __name__ == '__main__':
    unittest.main()
